<?php
if(strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 8.0")) {
	$visitor_browser = "8";
} elseif(strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 7.0")) {
	$visitor_browser = "7";
} elseif(strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 6.0")) {
	$visitor_browser = "6";
} else {
	$visitor_browser = "others";
}
date_default_timezone_set ("Asia/Chongqing");

define('WEB_DIR', str_replace('includes/init.php', '', str_replace('\\', '/', __FILE__)));
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR);
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR);
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'DSC'.DIRECTORY_SEPARATOR);
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'DSC'.DIRECTORY_SEPARATOR.'controller');
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'DSC'.DIRECTORY_SEPARATOR.'dao');
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'DSC'.DIRECTORY_SEPARATOR.'server');
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'DSC'.DIRECTORY_SEPARATOR.'controller'.DIRECTORY_SEPARATOR.'index');
set_include_path(get_include_path().PATH_SEPARATOR.WEB_DIR.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'index'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR);


$constant_file =  WEB_DIR.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'inc_constant.php';

$config_file = WEB_DIR.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php';
if(file_exists($config_file)){
	include $config_file;
}
if(file_exists($constant_file)){
	require $constant_file;
}

$file_url = WEB_DIR.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'FileUrl.php';
if(file_exists($file_url)){
	require $file_url;
}

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
$register = Zend_Registry::getInstance();
Zend_Session::start();
define('SESS_ID', Zend_Session::getId());
$default_lang = 'zh_cn';

if(file_exists(WEB_DIR.DIRECTORY_SEPARATOR.'languages'.DIRECTORY_SEPARATOR .$default_lang.DIRECTORY_SEPARATOR.$work_dir.DIRECTORY_SEPARATOR.'Common.php')){
	include WEB_DIR.DIRECTORY_SEPARATOR.'languages'.DIRECTORY_SEPARATOR .$default_lang. DIRECTORY_SEPARATOR.$work_dir.DIRECTORY_SEPARATOR.'Common.php';
}
if(file_exists(WEB_DIR.DIRECTORY_SEPARATOR.'languages'.DIRECTORY_SEPARATOR .$default_lang.DIRECTORY_SEPARATOR.$work_dir.DIRECTORY_SEPARATOR.ucfirst($server_module).'.php')){
	include WEB_DIR.DIRECTORY_SEPARATOR.'languages'.DIRECTORY_SEPARATOR .$default_lang. DIRECTORY_SEPARATOR.$work_dir.DIRECTORY_SEPARATOR.ucfirst($server_module).'.php';
}

$common_func =  WEB_DIR.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'CommonFun.php';
if(file_exists($common_func)){
	require $common_func;
}
?>
